package com.ler.yrmall.order.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ler.yrmall.coupon.dto.SeckillOrderDTO;
import com.ler.yrmall.basic.Form;
import com.ler.yrmall.order.entity.OrderEntity;
import com.ler.yrmall.order.form.OrderSubmitForm;
import com.ler.yrmall.order.form.OrderFrom;
import com.ler.yrmall.order.form.SingleOrderConfirmForm;
import com.ler.yrmall.order.vo.MemberOrderVO;
import com.ler.yrmall.order.vo.OrderConfirmVO;

import java.math.BigDecimal;

/**
 * 订单
 *
 * @author Leron
 */
public interface OrderService extends IService<OrderEntity> {

    /**
     * 分页
     *
     * @param request
     * @return
     */
    IPage<OrderEntity> find(Form request);

    /**
     * 获取订单确认数据
     *
     * @param couponId
     * @return
     */
    OrderConfirmVO getCartOrderConfirm(Long couponId);

    /**
     * 提交订单
     *
     * @param orderSubmitVO
     * @return
     */
    OrderEntity submit(OrderSubmitForm orderSubmitVO);

    /**
     * 根据订单号查询
     *
     * @param orderSn
     * @return
     */
    OrderEntity getOrderByOrderSn(String orderSn);

    /**
     * 关闭订单
     *
     * @param order
     */
    void closeOrder(OrderEntity order);

    /**
     * 创建秒杀订单
     *
     * @param message
     */
    void createSeckillOrder(SeckillOrderDTO message);


    /**
     * 获取单个商品下单确认单
     *
     * @param request
     * @return
     */
    OrderConfirmVO getSingleOrderConfirm(SingleOrderConfirmForm request);

    /**
     * 会员订单
     *
     * @param request
     * @return
     */
    IPage<MemberOrderVO> memberOrder(OrderFrom request);

    /**
     * 交易额统计
     *
     * @return
     */
    BigDecimal getTradeAmount();

    /**
     * 模拟支付
     * @param payWay
     * @param orderSn
     */
    void simulatePay(Integer payWay, String orderSn);
}

